home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1997 May / PC Plus Super CD Issue 127 (May 1997).iso / handson / lrnpasc / syntax2 / syntsum2.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1997-02-01  |  1.4 KB  |  70 lines

  1. unit Syntsum2;
  2. { PC Plus - learning Pascal with Delphi
  3.   lesson 2.
  4.   Syntax summary }
  5.  
  6. interface
  7.  
  8. uses
  9.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  10.   Forms, Dialogs, StdCtrls;
  11.  
  12. type
  13.   TForm1 = class(TForm)
  14.     Button1: TButton;
  15.     Button2: TButton;
  16.     Button3: TButton;
  17.     procedure Button1Click(Sender: TObject);
  18.     procedure Button2Click(Sender: TObject);
  19.     procedure Button3Click(Sender: TObject);
  20.   private
  21.     { Private declarations }
  22.   public
  23.     { Public declarations }
  24.   end;
  25.  
  26. var
  27.   Form1: TForm1;
  28.  
  29. implementation
  30.  
  31. {$R *.DFM}
  32.  
  33. procedure ChangeCaption;
  34. begin
  35.   Form1.Caption := 'Wheee!';
  36. end;
  37.  
  38. procedure NewCaption( nc, nc2 : string );
  39. { arguments must be listed along with their type.
  40.   arguments of the same type can be separated by commas: e.g.
  41.      ( i, x : integer );
  42.   different types or arguments are separated by semi-colons: e.g.
  43.      ( i, x : integer; s : string );
  44. }
  45. begin
  46.   Form1.Caption := nc + nc2;
  47. end;
  48.  
  49. function TheFormCaption : string;
  50. begin
  51.   TheFormCaption := Form1.Caption;
  52. end;
  53.  
  54. procedure TForm1.Button1Click(Sender: TObject);
  55. begin
  56.    NewCaption( 'Hello', ' world' );
  57. end;
  58.  
  59. procedure TForm1.Button2Click(Sender: TObject);
  60. begin
  61.    ChangeCaption;
  62. end;
  63.  
  64. procedure TForm1.Button3Click(Sender: TObject);
  65. begin
  66.   Button3.Caption := TheFormCaption;
  67. end;
  68.  
  69. end.
  70.